package cn.i7baozh.starter.client.service.impl;

import cn.i7baozh.starter.client.remote.TestRemoteService;
import cn.i7baozh.starter.client.remote.TestRemoteService2;
import cn.i7baozh.starter.client.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;

/**
 * @author : baoqi.zhang
 * @date :   2022/5/10 14:56
 */
@RefreshScope
@Service
public class TestServiceImpl implements TestService {

    @Value("${server.port}")
    private String serverPort;

    @Value("${config.value:}")
    private String configValue;

    @Autowired
    private TestRemoteService testRemoteService;
    @Autowired
    private TestRemoteService2 testRemoteService2;

    @Override
    public String clientSayHello(String name) {
        return "来自客户端[" + serverPort + "] , 接收到的配置信息为: " + configValue + " 。 \r\t" + testRemoteService.sayHello(name);
    }

    @Override
    public String clientSayHi(String name) {
        return "来自客户端[" + serverPort + "] , 接收到的配置信息为: " + configValue + " 。 \r\t" + testRemoteService2.sayHi(name);
    }
}
